var t = getApp(), e = t.requirejs('core'), a = t.requirejs("foxui");
Page({
    data: {
        orderid:0,
        order:[],
        store:[],
        saler:[],
        lastverifys:[],
        allgoods:[],
        goods:[],
        verifyinfo:[],
        carrier:[],
        shopname:"",
        submit:!1
    },
    onLoad(s) {
        var item = decodeURIComponent(s.scene);
        if (!s.id && item) {
            var n = e.str2Obj(item);
            s.id = n.id;
        }
        // console.log(s);return
        e.get("yam/hexiao/getbasic", s, res => {
            if(res.error==0){
                this.setData({
                    orderid: s.id,
                    shopname: res.shopname,
                    order: res.order,
                    store: res.store,
                    saler: res.saler,
                    lastverifys: res.lastverifys,
                    allgoods: res.allgoods,
                    goods: res.goods,
                    verifyinfo: res.verifyinfo,
                    carrier: res.carrier
                })
            }else{
                wx.navigateTo({
                    url: "/yam/status/index?status=oerror&msg="+res.message
                });
            }
        })
    },
    hexiao() {
        let t = this;
        wx.showModal({
            title: "提示",
            content: "确认核销吗？",
            success(res) {
                var orderid = t.data.orderid;
                var verifycode = t.data.order.verifycode;
                var times = 1;
                res.confirm && e.get("yam/hexiao/complete", {id:orderid,verifycode:verifycode,times:times}, res => {
                    console.log(res);
                    if (0 != res.error) return a.toast(t, res.message);
                    wx.navigateTo({
                        url: "/yam/status/index?status=success"
                    });
                })
            }
        })
    }
})